package lab02.test03;

class Student {//自定义一个学生的类
    private String name;
    private double computer;
    private double math;
    private double english;//定义成员变量

    Student(String name, double computer, double math,
            double english) {
        this.name = name;
        this.computer = computer;
        this.math = math;
        this.english = english;//封装的数据
    }

    //使用set,get方法获取数据

    public void setName(String name) {
        this.name = name;
    }

    String getName() {
        return name;
    }


    public void setComputer(double computer) {
        this.computer = computer;
    }

    double getComputer() {
        return computer;
    }


    public void setMath(double math) {
        this.math = math;
    }

    double getMath() {
        return math;
    }


    public void setEnglish(double english) {
        this.english = english;
    }

    double getEnglish() {
        return english;
    }

    //单独写总分的算法
    double total() {
        return computer + math + english;
    }

    //单独写平均分的算法
    double average() {
        return (computer + math + english) / 3;
    }

    //计算最高分
    double max() {
        double max = computer > math ? computer : math;
        max = max > english ? max : english;
        return max;
    }

    //计算最低分
    double min() {
        double min = computer < math ? computer : math;
        min = min < english ? min : english;
        return min;
    }
}
